package config_table

import (
	"base"
	"fmt"
)

type assetTable struct {
	Items map[base.AssetItemId]base.AssetType
}

var (
	Asset = new(assetTable)
)

func init() {
	Asset.Items = make(map[base.AssetItemId]base.AssetType)
}

func (table *assetTable) register(id base.AssetItemId, t base.AssetType) (err error) {
	if _, exists := Asset.Items[id]; exists {
		err = fmt.Errorf("item id %v is repeat", id)
		return
	}

	Asset.Items[id] = t
	return
}
